package org.blogwu.learn.multithread.chapter2.demo2;

public class Main3 {

    static volatile boolean b = true;

    public static void main(String[] args) {

        Thread t1 = new Thread(() -> {
            while (b) {

            }
            b = true;
            System.out.println("this:" + Thread.currentThread().isInterrupted());
            System.out.println("this:" + Thread.interrupted());
            System.out.println("this:" + Thread.interrupted());
            System.out.println("this:" + Thread.currentThread().isInterrupted());
        });

        t1.start();

        t1.interrupt();
//        System.out.println(t1.isInterrupted());
//        System.out.println(Thread.interrupted());
//        System.out.println(Thread.interrupted());
        b = false;

    }
}
